package com.jdkreader.concurrency.concurrent.pipeline;


/**
 * 汽车实体类
 */
public class Car {

    private final int id;
    //汽车发动机，车厢和轮子
    private boolean engine,driveTrain,wheels=false;

    public Car(int idn){
        id=idn;
    }
    //default empty constructor
    public Car(){
       id=-1;
    }

    public synchronized int getId(){
        return id;
    }

    public synchronized void addEngine(){
        engine=true;
    }

    public synchronized void addDriveTrain(){
        driveTrain=true;
    }

    public synchronized void addWheels(){
        wheels=true;
    }

    @Override
    public String toString() {
        return "Car{" +
                "id=" + id +
                ", engine=" + engine +
                ", driveTrain=" + driveTrain +
                ", wheels=" + wheels +
                '}';
    }
}
